///////////////////////////////////////////
// Authors : Mathieu Robitaille - 6396682
//           Sacha Sukhdeo - 6054412
// Class : COMP445
//         Assignment 2
///////////////////////////////////////////
#pragma once

#define WIN32_LEAN_AND_MEAN

#include <Thread.h>
#include <TcpBase.h>

#define MAXPENDING 10

#pragma comment (lib, "ws2_32.lib")

class TcpServer
{
	int serverSock,clientSock;     /* Socket descriptor for server and client*/
	struct sockaddr_in ClientAddr; /* Client address */
	struct sockaddr_in ServerAddr; /* Server address */
	int clientLen;				   /* Length of Server address data structure */
	char servername[HOSTNAME_LENGTH];
public:
	TcpServer();
	~TcpServer();
	void start();
};

class TcpThread : public Thread, public TcpBase
{
public: 
	TcpThread(SOCKET serverSocket) : ss(serverSocket)  {}
	void run();
    std::string LogFile() const { return std::string("server.log"); }
private:
    SOCKET cs;
    SOCKET ss;
    SOCKADDR_IN m_clientAddr;
	SOCKADDR_IN m_serverAddr;
};
